package com.tiancheng.trade.settlement.vo.settlement.admin.res;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @Auther: liudong
 * @Date: 2024/4/27 16:57
 * @Param ${tags}
 * @Description:
 */
@Data
public class SubOrderResVO {

    /**
     * id
     */
    private String id;
    /**
     * 主订单号
     */
    private String orderId;
    /**
     * 优惠券类型
     */
    private String couponType;
    /**
     * 子订单号
     */
    private String subOrderId;
    /**
     * 源子订单号
     */
    private String originalSubOrderId;
    /**
     * 业务渠道来源
     */
    private String orderSource;
    /**
     * 商户编码
     */
    private String merchantCode;
    /**
     * 商户名称
     */
    private String merchantName;
    /**
     * 产品编码
     */
    private String productCode;
    /**
     * 产品名称
     */
    private String productName;
    /**
     * 产品明细
     */
    private String productDetail;
    /**
     * 商品数量
     */
    private Integer productCount;
    /**
     * 应收金额
     */
    private Integer subOrderAmount;
    /**
     * 支付金额
     */
    private Integer payAmount;

    /**
     * 退款金额
     */
    private Integer refundAmount;
    /**
     * 是否有优惠
     */
    private Boolean isCoupon;
    /**
     * 优惠总金额
     */
    private Integer discount;
    /**
     * 子订单状态
     */
    private String subOrderStatus;
    /**
     * 子订单退款状态
     */
    private String refundStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime createdDt;

    /**
     * 通道费率
     */
    private BigDecimal rate;

    /**
     * 支付订单号
     */
    private String paymentId;

    /**
     * 收单机构流水号 （渠道支付订单号）
     */
    private String payChannelOrderid;

    /**
     * 支付订单交易时间
     */
    private LocalDateTime payTime;
    /**
     * 支付订单创建时间
     */
    private LocalDateTime payCreateTime;

    /**
     * 支付方式
     */
    private String payWay;

    /**
     * 支付渠道
     */
    private String payChannel;

    /**
     * 订单金额
     */
    private Integer orderAmount;

    // 主订单
    private OrderResVO order;

    // 优惠券
    private List<CouponResVO> coupons;

    //结算类型
    private String settlementType;

    //差异金额
    private Integer errorAmount;

    public Integer getProductCount() {
        if (null == productCount) {
            productCount = 0;
        }
        return productCount;
    }

    public Integer getSubOrderAmount() {
        if (null == subOrderAmount) {
            subOrderAmount = 0;
        }
        return subOrderAmount;
    }

    public Integer getPayAmount() {
        if (null == payAmount) {
            payAmount = 0;
        }
        return payAmount;
    }

    public Integer getRefundAmount() {
        if (null == refundAmount) {
            refundAmount = 0;
        }
        return refundAmount;
    }

    public Integer getDiscount() {
        if (null == discount) {
            discount = 0;
        }
        return discount;
    }

    public BigDecimal getRate() {
        if (null == rate) {
            rate = new BigDecimal(0);
        }
        return rate;
    }

    public Integer getErrorAmount() {
        if (null == errorAmount) {
            errorAmount = 0;
        }
        return errorAmount;
    }

}
